package my.soft.aiteacher.common.controller;


import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import my.soft.aiteacher.common.pojo.MPage;
import my.soft.aiteacher.common.pojo.VideoInformationVo;
import my.soft.aiteacher.teacher.pojo.VideoSearch;
import my.soft.aiteacher.common.service.IVideoInformationService;
import my.soft.aiteacher.target.ViewCount;
import my.soft.aiteacher.utils.R;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 视频信息 前端控制器
 * </p>
 *
 * @author GMCX
 * @since 2025-06-06
 */
@RestController
@Tag(name = "公共-视频信息管理",description = "公共-视频信息管理")
@RequestMapping("/videoInformation")
public class VideoInformationController {
    @Resource
    private IVideoInformationService videoInformationService;
    @Operation(summary = "分页查询视频信息")
    @RequestMapping(value = "/page",method = RequestMethod.POST)
    public R getVideoInformationList(@RequestBody MPage page){
        Map<String, Object> videoInformationList = videoInformationService.getVideoInformationList(page);
        return R.success(videoInformationList);
    }

    @Operation(summary = "查询视频")
    @RequestMapping(value = "/query",method = RequestMethod.POST)
    public R queryVideoInformationList(@RequestBody VideoSearch videoSearch){
        Map<String, Object> videoInformationVoList = videoInformationService.queryVideoInformationList(videoSearch);
        return R.success(videoInformationVoList);
    }
    @ViewCount
    @Operation(summary = "查询视频详情")
    @RequestMapping(value = "/detail/{fileId}",method = RequestMethod.POST)
    public R getVideoInformationDetail(@PathVariable Long fileId){
        VideoInformationVo videoInformationVo = videoInformationService.getVideoInformationDetail(fileId);
        return R.success(videoInformationVo);
    }
    @Operation(summary = "返回热门视频信息")
    @RequestMapping(value = "/hot",method = RequestMethod.GET)
    public R getHotVideoInformation(){
        List<VideoInformationVo> videoInformationVoList = videoInformationService.getHotVideoInformation();
        return R.success(videoInformationVoList);
    }


}
